<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h2>history02</h2>
<button>跳转页面</button>
<button>回退</button>
<button>前进</button>

<script>
    document.querySelector('button').onclick = function () {
        window.location.href = "07-history03.html"
    }


    document.querySelectorAll('button')[1].onclick = function () {
        // 回退
        window.history.back()
    }

    document.querySelectorAll('button')[2].onclick = function () {
        // 前进
        window.history.forward()
    }
</script>
</body>
</html>
